package com.shareach.domain;

import java.util.Arrays;
import java.util.Date;

import org.apache.commons.lang.StringUtils;
import org.springframework.data.mongodb.core.mapping.Document;

import com.shareach.domain.common.Entity;

/**
 * 城市商圈
 * 
 * @author zuoshuaiok@gmail.com
 * 
 *         2013-1-28
 */
@Document(collection = "baseZoom")
public class BaseZoomDomain extends Entity {

	private Long cityId;
	private String name;
	// 更新时间或者创建时间
	private Date updateTime = new Date();
	// 上架时间
	private Date deployTime;
	// 创建时间
	private Date creatTime;
	// 坐标
	private Double[] location;
	//
	private String icon;
	
	// 状态
	private Integer status;

	public String getIcon() {
		return icon;
	}

	public Double[] getLocation() {
		return location;
	}

	public Long getCityId() {
		return cityId;
	}

	public void setCityId(Long cityId) {
		this.cityId = cityId;
	}

	public void setLocation(Double[] location) {
		this.location = location;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public Date getCreatTime() {
		return creatTime;
	}

	public void setCreatTime(Date creatTime) {
		this.creatTime = creatTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public Date getDeployTime() {
		return deployTime;
	}

	public void setDeployTime(Date deployTime) {
		this.deployTime = deployTime;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public BaseZoomDomain compareTo(BaseZoomDomain domain) {
		BaseZoomDomain change = new BaseZoomDomain();
		if (null == domain)
			return change;
		if (StringUtils.isNotEmpty(domain.getName())) {
			if (this.name == null || !this.name.trim().equals(domain.getName().trim())) {
				change.setName(domain.getName());
			}
		}
		if (StringUtils.isNotEmpty(domain.getIcon())) {
			if (this.icon == null || !this.icon.trim().equals(domain.getIcon().trim())) {
				change.setIcon(domain.getIcon());
			}
		}
		if (domain.getLocation() != null && domain.getLocation().length > 0) {
			if (this.location == null || !Arrays.equals(this.location, domain.getLocation())) {
				change.setLocation(domain.getLocation());
			}
		}
		if (domain.getStatus() != null) {
			if (this.status == null ||! this.status.equals(domain.getStatus())) {
				change.setStatus(domain.getStatus());
			}
		}
		return change;
	}

}
